package com.chief;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chief.entity.Goods;
import com.chief.entity.Order;
import com.chief.mapper.GoodsMapper;
import com.chief.mapper.OrderMapper;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.transaction.annotation.Transactional;

@DubboService
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderTestService{

    @Autowired
    private OrderMapper orderMapper;


    @DubboReference
    private GoodsTestService goodsTestService;

    @Override
    public void create(String title, Integer goodsId) {
        this.goodsTestService.reduce(title,goodsId);
        if(goodsId.equals(6)){
            System.out.println(goodsId/0);
        }
        Order order = new Order();
        order.setGoodsId(goodsId);
        order.setTitle(title);
        super.save(order);
    }
}
